import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;

@SuppressWarnings({"all"})
public class Generic_ {
    public static void main(String[] args) {
        HashSet<Student> hashSet=new HashSet<Student>();
        hashSet.add(new Student("xx"));
        hashSet.add(new Student("kk"));
        HashMap<String,Student> hashmap=new HashMap<String,Student>();
        hashmap.put("xx",new Student("xx"));
        hashmap.put("ll",new Student("ll"));
        for (Student student :hashSet) {
            System.out.println(student);
        }
        Iterator<Student> iterator= hashSet.iterator();
        while (iterator.hasNext()) {
            Student next =  iterator.next();
            System.out.println(next);
        }
        Iterator<Map.Entry<String,Student>> iterator1= hashmap.entrySet().iterator();
        while (iterator1.hasNext()) {
            Map.Entry<String, Student> next =  iterator1.next();
            System.out.println(next);
        }

    }
}
class Student{
    private String name;

    public Student(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                '}';
    }
}